﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StockTrader.FrontEnd.DataContract
{
    public class HoseMarketUI
    {
        private string _transDate;
        public string TransDate
        {
            get { return _transDate; }
            set { _transDate = value; }
        }
        private string _accountNo;
        public string AccountNo
        {
            get { return _accountNo; }
            set { _accountNo = value; }
        }
        private string _side;
        public string Side
        {
            get { return _side; }
            set { _side = value; }
        }
        private string _symbol;
        public string Symbol
        {
            get { return _symbol; }
            set { _symbol = value; }
        }
        private string _orderType;
        public string OrderType
        {
            get { return _orderType; }
            set { _orderType = value; }
        }
        private string _status;
        public string Status
        {
            get { return _status; }
            set { _status = value; }
        }
        private long _vol;
        public long Vol
        {
            get { return _vol; }
            set { _vol = value; }
        }
        private string _price;
        public string Price
        {
            get { return _price; }
            set { _price = value; }
        }

        private long _Mvol;
        public long MVol
        {
            get { return _Mvol; }
            set { _Mvol = value; }
        }
        private string _time;
        public string Time
        {
            get { return _time; }
            set { _time = value; }
        }

        private string _pc;
        public string PC
        {
            get { return _pc; }
            set { _pc = value; }
        }
        private string _company;
        public string Company
        {
            get { return _company; }
            set { _company = value; }
        }

        public HoseMarketUI(DateTime transdate, string side, string symbol, long price, string pc, string accountno, string status, int time, string ordertype, long vol, long mvol, string company)
        {
            this._transDate = transdate.ToString("yyyy/MM/dd");
            this._side = side.Trim().Substring(0, 1).Equals("B") ? "MUA" : "BÁN";
            this._symbol = symbol;
            //this._price = price;
            this._status = (mvol > 0) ? "KHỚP" : String.Empty;
            this._accountNo = accountno;
            switch (pc.Trim())
            {
                case "M":
                    this._pc = "TỔ CHỨC";
                    break;
                case "F":
                    this._pc = "NƯỚC NGOÀI";
                    break;
                case "P":
                    this._pc = "TỰ DOANH";
                    break;
                default:
                    this._pc = "CÁ NHÂN";
                    break;
            }
            this._time = String.Format("{0:##:##:##}", time/100);
            //this._orderType = ordertype;
            if (price > 0)
                this._price = String.Format("{0:0,0}", price);
            else
            {
                if (time <= 9000000)
                    this._price = "ATO";
                else
                    this._price = "ATC";
            }

            this._vol = vol;
            this._Mvol = mvol;
            this._company = company;
        }
    }
}
